1 /* 2 * Copyright (C) 2017 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 /** 18 * @addtogroup Memory 19 * @{ 20 */ 21 22 /** 23 * @file sharedmem_jni.h 24 * @brief Shared memory buffers that can be shared across process. 25 */ 26 27 module android.ndk.sharedmem_jni; 28 29 import arsd.jni; 30 import android.ndk; 31 32 extern (C): 33 nothrow: 34 @nogc: 35 36 /****************************************************************** 37 * 38 * IMPORTANT NOTICE: 39 * 40 * This file is part of Android's set of stable system headers 41 * exposed by the Android NDK (Native Development Kit). 42 * 43 * Third-party source AND binary code relies on the definitions 44 * here to be FROZEN ON ALL UPCOMING PLATFORM RELEASES. 45 * 46 * - DO NOT MODIFY ENUMS (EXCEPT IF YOU ADD NEW 32-BIT VALUES) 47 * - DO NOT MODIFY CONSTANTS OR FUNCTIONAL MACROS 48 * - DO NOT CHANGE THE SIGNATURE OF FUNCTIONS IN ANY WAY 49 * - DO NOT CHANGE THE LAYOUT OR SIZE OF STRUCTURES 50 */ 51 52 /** 53 * Returns a dup'd FD from the given Java android.os.SharedMemory object. The returned file 54 * descriptor has all the same properties & capabilities as the FD returned from 55 * ASharedMemory_create(), however the protection flags will be the same as those of the 56 * android.os.SharedMemory object. 57 * 58 * Use close() to release the shared memory region. 59 * 60 * Available since API level 27. 61 * 62 * \param env The JNIEnv* pointer 63 * \param sharedMemory The Java android.os.SharedMemory object 64 * \return file descriptor that denotes the shared memory; -1 if the shared memory object is 65 * already closed, if the JNIEnv or jobject is NULL, or if there are too many open file 66 * descriptors (errno=EMFILE) 67 */ 68 int ASharedMemory_dupFromJava (JNIEnv* env, jobject sharedMemory); 69 70 // __ANDROID_API__ >= 27 71 72 // ANDROID_SHARED_MEMORY_JNI_H 73 74 /** @} */